package es.ucm.is.www.GUI.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.widgetideas.client.YouTubeViewer;

/**
 * <p>Title: IntroPanel.java </p>
 *
 * <p>Description: Clase que genera el panel principal de la aplicacion
 * cuando se accede ahora </p>
 *
 * <p>Copyright: </p>
 *
 * @author 
 * @version 1.0
 * @see
 */ 
public class IntroPanel extends Composite {

	private VerticalPanel mainPanel;
	private HorizontalPanel introPanel;
	private HorizontalPanel newsPanel;
	private HorizontalPanel newsBoxPanel;
	private Image introImage;
	private Image newImage;
	private Image newsBoxImage;
	
	/**
	 * @param mainPanel: Panel principal de la aplicacion
	 * @param introPanel: Panel de entrada
	 * @param newsPanel: Panel de novedades
	 * @param newsBoxPanel: Panel sobre el que se cargan las noticias
	 * @param introImage: Imagen de inicio
	 * @param newImage: Imagen de novedades
	 * @param newsBoxImage: Imagen del panel de noticias 
	 */
	
	/**
	 * <p>Description: Metodo que genera el panel de entrada </p>
	 * @return: Devuelve el panel de entrada generado
	 */
	private HorizontalPanel createIntroPanel() {
		introPanel = new HorizontalPanel();
		introImage = new Image("images/intro.jpg");
		introPanel.add(introImage);
		return introPanel;
		
	}
	
	/**
	 * <p>Description: Metodo que genera el panel de novedades </p>
	 * @return: Devuelve el panel de novedades generado
	 */
	private HorizontalPanel createNewsPanel() {
		newsPanel = new HorizontalPanel();
		newImage = new Image("images/tit-novedades.jpg");
		newsPanel.add(newImage);
		return newsPanel;
		
	}
	/**
	 * <p>Description: Metodo que genera el panel de noticias </p>
	 * @return: Devuelve el panel de noticias generado
	 */
	private HorizontalPanel createNewsBoxPanel() {
		newsBoxPanel = new HorizontalPanel();
		newsBoxImage = new Image("images/tit-newsbox.jpg");
		newsBoxPanel.add(newsBoxImage);
		return newsBoxPanel;
		
	}
	
	
	/**
	 * <p>Description: Constructora que genera el panel de entrada </p>
	 */
	public IntroPanel() {
		/*mainPanel = new DockPanel();
		HorizontalPanel panel = createIntroPanel();
		HorizontalPanel panelNews = createNewsBoxPanel();
		mainPanel.add(panel, DockPanel.NORTH);
		mainPanel.add(panelNews, DockPanel.SOUTH);
		mainPanel.add(panelNews, DockPanel.SOUTH);
		initWidget(mainPanel);*/
		//YouTubeViewer r = new YouTubeViewer("BaE8-DinIuM");
		//r.setStyleName("YouTubeViewer");
		//r.setSize("660px", "525");
		
		/*HTML html2 = new HTML("<object width=" + "460" + "height=" + "325" + "><param name=" + "movie" +"value=" + "http://www.youtube.com/v/BaE8-DinIuM&hl=es&fs=1&rel=0&color1=0x234900&color2=0x4e9e00&border=1"
				+"></param><param name=" + "allowFullScreen"  + "value=" + "true" + "></param><param name=" + "allowscriptaccess" + "value=" + "always" + "></param><embed src=" + "http://www.youtube.com/v/BaE8-DinIuM&hl=es&fs=1&rel=0&color1=0x234900&color2=0x4e9e00&border=1" + "type="
				+ "application/x-shockwave-flash"  + "allowscriptaccess=" + "always" + "allowfullscreen=" + "true" + "width=" + "660"  + "height=" + "525" + "></embed></object>");*/
		//html2.setWidth("470px");
		//html2.setHeight("335px");
		HTML html = new HTML(" <h5><img src=\"images/intro.jpg\" width=\"590\" height=\"181\" id=\"welcome_note\" alt=\"\" /></h5> " +                
							 " <h1 class=\"TopBorder\">Thanks for dropping by</h1> " +
							 " <div id=\"novedades\" style=\"width:299px; margin-left: 10px; padding-right: 5px; margin-right: 10px; float:left; border-right: 1px dotted #000000;\"> " +
							 " <img src=\"images/tit-novedades.jpg\" alt=\"Novedades del Foro\" style=\"margin-left: 60px;\" /> " +
							 " <ul class=\"style_1\"> " +
							 " <li>Novedad 1</li> " +
							 " <li>Novedad 2</li> " +
							 " </ul> " +            
							 " </div> " +
							 " <div id=\"newsbox\" style=\"width:300px; margin-left: 10px; margin-right: 10px; float:left;\"> " +
							 " <img src=\"images/tit-newsbox.jpg\" alt=\"Newsbox\" style=\"margin-left: 60px;\" /> " +
							 " <ul class=\"style_1\"> " +
							 " <li>News 1</li> " +
							 " <li>News 2</li> " +
							 " </ul> " +
							 " </div> ");
		
		//mainPanel = new DockPanel();
		//SimplePanel p =  new SimplePanel();
		//p.setStyleName("videoIntro");
		//p.setWidget(r);
		mainPanel = new VerticalPanel();
		mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		//mainPanel.add(p);
		mainPanel.add(html);
		//mainPanel.add(html, DockPanel.CENTER);
		initWidget(mainPanel);
		
	}
	
	
}
